package ATM;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileReader;
import java.util.Properties;

public class AskFrame extends JFrame {
    private String myMoney;
    private Properties p = new Properties();

    public AskFrame(){

        try {
            p.load(new FileReader("Housework0906/src/ATM/ATM.txt"));
        }catch (Exception e){
            System.out.println("文件不存在");
        }

        myMoney = p.getProperty("money");


        this.setLayout(null);

        JLabel jl = new JLabel("账号余额："+myMoney+"元");
        jl.setBounds(180,80,200,50);
        this.add(jl);

        MyButton askButton = new MyButton("返回",350,200,this);

        this.setSize(500,300);
        this.setVisible(true);
        this.setDefaultCloseOperation(3);
        this.setLocationRelativeTo(null);
        this.setTitle("查询");


        askButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                back();
            }
        });
    }

    private void back(){
        this.dispose();
        new ItemFrame();
    }
}
